﻿namespace Guia.Elements.PatternServants
{
    using System;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// This class represents the abstract super-class for all classes implementing a particular UIA-pattern and act as servant for this pattern to UiElement-classes.
    /// </summary>
    public abstract class AbstractPatternServant
    {
        /// <summary>
        /// The underlying UiElement (client). 
        /// </summary>
        private readonly UiElement uiElement;

        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractPatternServant"/> class. 
        /// </summary>
        /// <param name="clientElement">
        /// The UiElement for which the servant provides functionality.
        /// </param>
        protected AbstractPatternServant(UiElement clientElement)
        {
            Contract.Requires<ArgumentNullException>(clientElement != null);
            this.uiElement = clientElement;
        }

        /// <summary>
        /// Gets the UiElement for which this servant provides functionality.
        /// </summary>
        protected UiElement UiElement
        {
            get { return this.uiElement; }
        }
    }
}